package com.maotouying.owlsmart.SmartUtil.Sqlite;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

public class DatabaseHelper extends SQLiteOpenHelper {

   @Override
    public void onCreate(SQLiteDatabase db) {
        //创建数据库sql语句 并 执行
        String sql = "CREATE TABLE IF NOT EXISTS userTable(id integer primary key autoincrement,owlId text,username text,password text,email text,phone text,token text,userProfileImage text)";

        //当前用户
       String present = "CREATE TABLE IF NOT EXISTS presentTable(id integer primary key autoincrement,owlId text,username text,password text,email text,phone text,token text,userProfileImage text)";

       db.execSQL(sql);
       db.execSQL(present);
    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {

        db.execSQL("DROP TABLE IF EXISTS userTable");//用户数据
        db.execSQL("DROP TABLE IF EXISTS presentTable");//用户数据
        onCreate(db);

    }

    //带全部参数的构造函数，此构造函数必不可少
    public DatabaseHelper(Context context, String name, SQLiteDatabase.CursorFactory factory, int version) {
        super(context, name, factory, version);
    }





}